package com.gsbelarus.gedemin.lib.ui.activity.drawer.adapter.table;

import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;

import com.gsbelarus.gedemin.lib.ui.activity.drawer.adapter.DrawerAdapter;

abstract public class DrawerItem {

    public static final long DIVIDER_ID = -1;

    private long id;
    private String text;
    private String summary;
    private Drawable image;
    private long counter = 0;
    private DrawerAdapter.ItemType type;

    private int activatedColor = 0;
    private int defaultDrawableColor;

    public String getText() {
        return text;
    }

    protected DrawerItem(long id, DrawerAdapter.ItemType type) {
        this.id = id;
        this.type = type;
    }

    public DrawerItem setText(String text) {
        this.text = text;
        return this;
    }

    public Drawable getImage() {
        return image;
    }

    public DrawerItem setImage(Drawable image) {
        this.image = image;
        if (image instanceof ColorDrawable)
            defaultDrawableColor = ((ColorDrawable) image).getColor();
        return this;
    }

    public long getCounter() {
        return counter;
    }

    public DrawerItem setCounter(long counter) {
        this.counter = counter;
        return this;
    }

    public String getSummary() {
        return summary;
    }

    public DrawerItem setSummary(String summary) {
        this.summary = summary;
        return this;
    }

    public DrawerAdapter.ItemType getType() {
        return type;
    }

    public long getId() {
        return id;
    }

    public int getActivatedColor() {
        return activatedColor;
    }

    public DrawerItem setActivatedColor(int activatedColor) {
        this.activatedColor = activatedColor;
        return this;
    }

    public int getDefaultDrawableColor() {
        return defaultDrawableColor;
    }
}
